<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">   
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">   								
	<head> 							
		<title>登录用户管理</title>
		<meta http-equiv="X-UA-Compatible" content="IE=7" />
		<%@ include file="../jslib/jquerylib.jsp" %>
		<link href="<%=request.getContextPath() %>/web/style/layout.css" type="text/css" rel="stylesheet"/>
	       <!-- 删除结果信息返回 -->
	    	<c:if test="${requestScope.message!=null}">
				<script type="text/javascript">
	  	 		     alert('<c:out value="${requestScope.message}"></c:out>');
	  			</script>
	        </c:if>
	<script type="text/javascript">
	$(document).ready(function(){
					$("#gridTable").jqGrid({
						url:'onlineUser!queryOnlineUser.action',
						datatype: "json",
						height: 450,
						autowidth: true, 
						colNames:['编号','用户名','登录名','所属部门','登录时间'],
						colModel:[
								{name:'userId',userId:'userId', width:60, key:true,hidden:true,hidedlg:true}, 
								{name:'userName',index:'userName', width:100},								
								{name:'loginName',index:'loginName', width:100},
								{name:'deptName',index:'deptName', width:200},
								{name:'realDate',index:'realDate', width:200}												
					],
						shrinkToFit:false,
					sortname:'id',
					sortorder:'desc',
					viewrecords:true,
					multiselect: true, // 是否显示复选框
					multiboxonly : true, 
					//gridview: true,  //提升速度
					rownumbers: true,//显示行号
					rownumWidth: 30, //行号的宽度
					rowNum:500,
					rowList:[15,20,50,200,500],
					toolbar: [false,"top"],
					jsonReader: {
						root:"rows",		// 数据行（默认为：rows）
						page: "page",  	// 当前页
						total: "total",  // 总页数
						records: "records",  // 总记录数
						repeatitems : false		// 设置成false，在后台设置值的时候，可以乱序。且并非每个值都得设
					},
					prmNames:{rows:"rows",page:"page",sort:"sidx",order:"sord",search:"search"},
					pager:"#gridPager",
					caption: "在线人员列表"									
			});
			
			    $("#consoleDlg").dialog({
			        autoOpen: false,      
			        modal: true,    // 设置对话框为模态（modal）对话框  
			        resizable: true,      
			        width: 700,  
			        buttons: {  // 为对话框添加按钮  
			            "关闭": function() {$("#consoleDlg").dialog("close")}
			        }  
			    }); 
				
				 jQuery("#gridTable").jqGrid('navGrid','#gridPager',{add:false,edit:false,del:false,search:false,refresh:false});
					jQuery("#gridTable").jqGrid('navButtonAdd','#gridPager',
								{ 	
								caption: "列状态",                          
								title: "Reorder Columns",                           
								onClickButton : function (){                               
								jQuery("#gridTable").jqGrid('setColumns');                           
								}
					}); 
								//doResize(); 										
	}); 
			//执行大小
	function doResize() { 
		var ss = getPageSize(); 
			 $("#gridTable").jqGrid('setGridHeight', ss.WinH-140);
				//$("#gridTable").jqGrid('setGridWidth', ss.WinW-20); 
			} 
	function refreshIt(){
		jQuery("#gridTable").jqGrid('setGridParam',
			{
				url:'onlineUser!queryOnlineUser.action'
			}).trigger("reloadGrid", [{page:1}]); 
	}
	 
	</script>	
	</head>
	<body>

	<form action="" method="post" ">
		 <table  cellspacing="1" cellpadding="1" class="tab" width="100%">
			<tr>
				<input id="refresh" type='button' value='刷新' onclick='refreshIt()' class='button_b' />	</tr>
			<tr>
				<td colspan="4">
					<table id="gridTable"></table>
					<div id="gridPager"></div>
				</td>
			</tr>
		</table>
		</form>
	</body>
</html>
